//编写一子函数，实现数据库的查询
//参数1:数据库指针 sqlite3 * mydb
//参数2:表名 const char * tbname
//返回值:查询成功返回0,失败返回-1
#include"../include/p.h"
int select_db(sqlite3 * mydb,const char * tbname)
{
	char sql[100];
	sprintf(sql,"select * from %s",tbname);
	printf("%s\n",sql);
	int ret=0;
	char * errmsg=NULL;
	//参数3:函数指针，函数名可以随意取，但函数类型必须对应
	ret=sqlite3_exec(mydb,sql,callback,NULL,&errmsg);
	if(ret!=SQLITE_OK)
	{
		printf("select error:%s\n",errmsg);
		return -1;
	}
	return 0;
}
